package com.ophiux.cs.domain.chat.domainservice;

import org.springframework.stereotype.Service;

import com.ophiux.cs.domain.chat.model.entity.CSChatMessageInfo;
import com.ophiux.cs.domain.chat.model.entity.CSChatMessageSend;
import com.ophiux.cs.domain.chat.model.entity.CSChatSession;
import com.ophiux.cs.domain.chat.model.valueobj.CSUserValue;
import com.ophiux.utils.exception.OphiuxParamException;

/**
 * 发送咨询消息
 * @author chenh
 *
 */
@Service("sendCSMessageDomainService")
public class SendCSMessageDomainService {

	/**
	 * 咨询聊天消息发送
	 * @param from	发送方会话
	 * @param to	接收方会话
	 * @param messageInfo	消息内容
	 * @return
	 * @throws OphiuxParamException
	 */
	public void sendCSMessage(CSChatSession from , CSChatSession to , CSChatMessageInfo messageInfo)
				throws OphiuxParamException {
		
		/*//设置消息发送人,消息发送记录
		CSChatMessageSend sendRecord = new CSChatMessageSend(from.getSESSIION_ID(), CSChatMessageSend.TYPE_SEND, messageInfo.getDIALOG_ID(), messageInfo);
		sendRecord.send(); //发送标记
*/		from.send(messageInfo);
		
		/*//设置消息接收人,消息发送记录
		CSChatMessageSend receiveRecord = new CSChatMessageSend(from.getSESSIION_ID(), CSChatMessageSend.TYPE_RECEIVE, messageInfo.getDIALOG_ID(), messageInfo);
		receiveRecord.receive();//接收标记
*/		to.receive(messageInfo);
		
	}
	
}
